/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.jfonia.view.components;

/**
 * An enumeration representing the roundness styles of HUD buttons. Using this
 * enumeration will make it easier to transition this code to support more
 * HUD controls, like check boxes and combo buttons.
 */
public enum Roundedness {
    /**
     * A roundedness of 95%, equates to almost a half-circle as the button
     * edge shape.
     */
    ROUNDED_BUTTON(.95),
    /**
     * A roundedness of 95%, equates to almost a half-circle as the button
     * edge shape.
     */
    COMBO_BUTTON(.45);

    private final double fRoundedPercentage;

    private Roundedness(double roundedPercentage) {
        fRoundedPercentage = roundedPercentage;
    }

    public int getRoundedDiameter(int controlHeight) {
        int roundedDiameter = (int) (controlHeight * fRoundedPercentage);
        // force the rounded diameter value to be even - odd values look lumpy.
        int makeItEven = roundedDiameter % 2;
        return roundedDiameter - makeItEven;
    }
}
